<!DOCTYPE html>
<html lang="en">
  <head>
      <meta charset="UTF-8">
      <title>动态添加元素</title>
    <script>
      function addImg() {
        //1.创建一只小猫img，拿到 dom对象
        var img = document.createElement("img");
        img.src = "../images/3.png";
        img.width = "100";
        //2.展示(挂载到dom树上) document.body
        document.body.appendChild(img);
      }
    </script>
  </head>

  <body>
    <input type="button" onclick="addImg()" value="点击创建一只小猫">
  </body>
</html>